//
//Copyright 2019 The Vitess Authors.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.

// This file contains the vttest topology configuration structures.
//
// The protobuf message "VTTestTopology" specifies the Vitess and
// database configuration of the "vttest" test component which can be
// used in end-to-end tests to test an application against an actual
// Vitess and MySQL server.
//
// To start a "vttest" instance, pass the "VTTestTopology" message,
// encoded in the protobuf compact text format, to
// py/vttest/run_local_database.py which in turn will send it to the
// Vitess test binary called "vtcombo".
//
// To encode a "VTTestTopology" message in the protobuf compact text
// format, create the protobuf in your test's native language first
// and then use the protobuf library to encode it as text.
// For an example in Python, see: test/vttest_sample_test.py
// In go, see: go/vt/vttest/local_cluster_test.go
//
// Sample encoded proto configurations would be as follow. Note there are
// multiple encoding options, see the proto documentation for more info
// (first and last quote not included in the encoding):
// - single keyspace named test_keyspace with one shard '0':
//   'keyspaces:<name:"test_keyspace" shards:<name:"0" > > '
// - two keyspaces, one with two shards, the other one with a redirect:
//   'keyspaces { name: "test_keyspace" shards { name: "-80" } shards { name: "80-" } } keyspaces { name: "redirect" served_from: "test_keyspace" }'

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.9
// 	protoc        v3.21.3
// source: vttest.proto

package vttest

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
	vschema "vitess.io/vitess/go/vt/proto/vschema"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// Shard describes a single shard in a keyspace.
type Shard struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// name has to be unique in a keyspace. For unsharded keyspaces, it
	// should be '0'. For sharded keyspace, it should be derived from
	// the keyrange, like '-80' or '40-80'.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// db_name_override is the mysql db name for this shard. Has to be
	// globally unique. If not specified, we will by default use
	// 'vt_<keyspace>_<shard>'.
	DbNameOverride string `protobuf:"bytes,2,opt,name=db_name_override,json=dbNameOverride,proto3" json:"db_name_override,omitempty"`
	unknownFields  protoimpl.UnknownFields
	sizeCache      protoimpl.SizeCache
}

func (x *Shard) Reset() {
	*x = Shard{}
	mi := &file_vttest_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Shard) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Shard) ProtoMessage() {}

func (x *Shard) ProtoReflect() protoreflect.Message {
	mi := &file_vttest_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Shard.ProtoReflect.Descriptor instead.
func (*Shard) Descriptor() ([]byte, []int) {
	return file_vttest_proto_rawDescGZIP(), []int{0}
}

func (x *Shard) GetName() string {
	if x != nil {
		return x.Name
	}
	return ""
}

func (x *Shard) GetDbNameOverride() string {
	if x != nil {
		return x.DbNameOverride
	}
	return ""
}

// Keyspace describes a single keyspace.
type Keyspace struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// name has to be unique in a VTTestTopology.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// shards inside this keyspace. Ignored if redirect is set.
	Shards []*Shard `protobuf:"bytes,2,rep,name=shards,proto3" json:"shards,omitempty"`
	// number of replica tablets to instantiate. This includes the primary tablet.
	ReplicaCount int32 `protobuf:"varint,6,opt,name=replica_count,json=replicaCount,proto3" json:"replica_count,omitempty"`
	// number of rdonly tablets to instantiate.
	RdonlyCount   int32 `protobuf:"varint,7,opt,name=rdonly_count,json=rdonlyCount,proto3" json:"rdonly_count,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Keyspace) Reset() {
	*x = Keyspace{}
	mi := &file_vttest_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Keyspace) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Keyspace) ProtoMessage() {}

func (x *Keyspace) ProtoReflect() protoreflect.Message {
	mi := &file_vttest_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Keyspace.ProtoReflect.Descriptor instead.
func (*Keyspace) Descriptor() ([]byte, []int) {
	return file_vttest_proto_rawDescGZIP(), []int{1}
}

func (x *Keyspace) GetName() string {
	if x != nil {
		return x.Name
	}
	return ""
}

func (x *Keyspace) GetShards() []*Shard {
	if x != nil {
		return x.Shards
	}
	return nil
}

func (x *Keyspace) GetReplicaCount() int32 {
	if x != nil {
		return x.ReplicaCount
	}
	return 0
}

func (x *Keyspace) GetRdonlyCount() int32 {
	if x != nil {
		return x.RdonlyCount
	}
	return 0
}

// VTTestTopology describes the keyspaces in the topology.
type VTTestTopology struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// all keyspaces in the topology.
	Keyspaces []*Keyspace `protobuf:"bytes,1,rep,name=keyspaces,proto3" json:"keyspaces,omitempty"`
	// list of cells the keyspaces reside in. Vtgate is started in only the first cell.
	Cells []string `protobuf:"bytes,2,rep,name=cells,proto3" json:"cells,omitempty"`
	// routing rules for the topology.
	RoutingRules *vschema.RoutingRules `protobuf:"bytes,3,opt,name=routing_rules,json=routingRules,proto3" json:"routing_rules,omitempty"`
	// mirror rules for the topology.
	MirrorRules   *vschema.MirrorRules `protobuf:"bytes,4,opt,name=mirror_rules,json=mirrorRules,proto3" json:"mirror_rules,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *VTTestTopology) Reset() {
	*x = VTTestTopology{}
	mi := &file_vttest_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *VTTestTopology) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*VTTestTopology) ProtoMessage() {}

func (x *VTTestTopology) ProtoReflect() protoreflect.Message {
	mi := &file_vttest_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use VTTestTopology.ProtoReflect.Descriptor instead.
func (*VTTestTopology) Descriptor() ([]byte, []int) {
	return file_vttest_proto_rawDescGZIP(), []int{2}
}

func (x *VTTestTopology) GetKeyspaces() []*Keyspace {
	if x != nil {
		return x.Keyspaces
	}
	return nil
}

func (x *VTTestTopology) GetCells() []string {
	if x != nil {
		return x.Cells
	}
	return nil
}

func (x *VTTestTopology) GetRoutingRules() *vschema.RoutingRules {
	if x != nil {
		return x.RoutingRules
	}
	return nil
}

func (x *VTTestTopology) GetMirrorRules() *vschema.MirrorRules {
	if x != nil {
		return x.MirrorRules
	}
	return nil
}

var File_vttest_proto protoreflect.FileDescriptor

const file_vttest_proto_rawDesc = "" +
	"\n" +
	"\fvttest.proto\x12\x06vttest\x1a\rvschema.proto\"E\n" +
	"\x05Shard\x12\x12\n" +
	"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +
	"\x10db_name_override\x18\x02 \x01(\tR\x0edbNameOverride\"\x9f\x01\n" +
	"\bKeyspace\x12\x12\n" +
	"\x04name\x18\x01 \x01(\tR\x04name\x12%\n" +
	"\x06shards\x18\x02 \x03(\v2\r.vttest.ShardR\x06shards\x12#\n" +
	"\rreplica_count\x18\x06 \x01(\x05R\freplicaCount\x12!\n" +
	"\frdonly_count\x18\a \x01(\x05R\vrdonlyCountJ\x04\b\x03\x10\x04J\x04\b\x04\x10\x05J\x04\b\x05\x10\x06\"\xcb\x01\n" +
	"\x0eVTTestTopology\x12.\n" +
	"\tkeyspaces\x18\x01 \x03(\v2\x10.vttest.KeyspaceR\tkeyspaces\x12\x14\n" +
	"\x05cells\x18\x02 \x03(\tR\x05cells\x12:\n" +
	"\rrouting_rules\x18\x03 \x01(\v2\x15.vschema.RoutingRulesR\froutingRules\x127\n" +
	"\fmirror_rules\x18\x04 \x01(\v2\x14.vschema.MirrorRulesR\vmirrorRulesB%Z#vitess.io/vitess/go/vt/proto/vttestb\x06proto3"

var (
	file_vttest_proto_rawDescOnce sync.Once
	file_vttest_proto_rawDescData []byte
)

func file_vttest_proto_rawDescGZIP() []byte {
	file_vttest_proto_rawDescOnce.Do(func() {
		file_vttest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_vttest_proto_rawDesc), len(file_vttest_proto_rawDesc)))
	})
	return file_vttest_proto_rawDescData
}

var file_vttest_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_vttest_proto_goTypes = []any{
	(*Shard)(nil),                // 0: vttest.Shard
	(*Keyspace)(nil),             // 1: vttest.Keyspace
	(*VTTestTopology)(nil),       // 2: vttest.VTTestTopology
	(*vschema.RoutingRules)(nil), // 3: vschema.RoutingRules
	(*vschema.MirrorRules)(nil),  // 4: vschema.MirrorRules
}
var file_vttest_proto_depIdxs = []int32{
	0, // 0: vttest.Keyspace.shards:type_name -> vttest.Shard
	1, // 1: vttest.VTTestTopology.keyspaces:type_name -> vttest.Keyspace
	3, // 2: vttest.VTTestTopology.routing_rules:type_name -> vschema.RoutingRules
	4, // 3: vttest.VTTestTopology.mirror_rules:type_name -> vschema.MirrorRules
	4, // [4:4] is the sub-list for method output_type
	4, // [4:4] is the sub-list for method input_type
	4, // [4:4] is the sub-list for extension type_name
	4, // [4:4] is the sub-list for extension extendee
	0, // [0:4] is the sub-list for field type_name
}

func init() { file_vttest_proto_init() }
func file_vttest_proto_init() {
	if File_vttest_proto != nil {
		return
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_vttest_proto_rawDesc), len(file_vttest_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   3,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_vttest_proto_goTypes,
		DependencyIndexes: file_vttest_proto_depIdxs,
		MessageInfos:      file_vttest_proto_msgTypes,
	}.Build()
	File_vttest_proto = out.File
	file_vttest_proto_goTypes = nil
	file_vttest_proto_depIdxs = nil
}
